package Java.BlackHorse.Map.TreeMap;

import java.util.Comparator;
import java.util.TreeMap;

public class TreeMapDemo1 {
    public static void main(String[] args) {
        TreeMap<Integer,String> tm = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
//                升序
//                return o1-o2;
//            降序
                return o2-o1;
            }
        });

        tm.put(5,"雷碧");
        tm.put(4,"粤利粤");
        tm.put(3,"九个核桃");
        tm.put(2,"脉劫");
        tm.put(1,"帅师傅");

        //默认升序排列
        System.out.println(tm);
    }
}
